Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): fixes error on tab, enter when only a single input element is on the page #11470

Merged
merged 2 commits into from
May 30, 2024

Conversation

jahorton
Copy link
Contributor

@jahorton jahorton commented May 17, 2024

Resolves an error reported by a user from KeymanWeb 16.0.

domManager.ts:1323 Uncaught TypeError: Cannot read properties of undefined (reading 'focus')
    at b.moveToNext (domManager.ts:1323:7)
    at a.newlineHandler (input.ts:168:11)
    at a.handleNewlineAtCaret (input.ts:154:7)
    at e.defaultRuleBehavior (keyboardProcessor.ts:151:15)
    at e.processKeystroke (keyboardProcessor.ts:277:31)
    at e._processKeyEvent (inputProcessor.ts:166:26)
    at e.processKeyEvent (inputProcessor.ts:101:16)
    at e.handleClick (preProcessor.ts:66:22)
    at e.raiseKeyEvent (preProcessor.ts:44:22)
    at e.modelKeyClick (visualKeyboard.ts:1004:7)

It was reported to occur whenever a page contained only one valid context-hosting element - an <input> - and when the user pressed the ENTER key on the touch OSK.

@keymanapp-test-bot skip

@jahorton jahorton requested a review from ermshiperete as a code owner May 17, 2024 04:53
@keymanapp-test-bot keymanapp-test-bot bot added this to the A18S2 milestone May 17, 2024
@@ -38,7 +38,7 @@ export default class DefaultBrowserRules extends DefaultRules {
const contextManager = this.contextManager;
const activeElement = contextManager.activeTarget?.getElement();
const nextElement = contextManager.page.findNeighboringInput(activeElement, back);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function can explicitly return null, yet we weren't null-guarding on the result.

@mcdurdin mcdurdin modified the milestones: A18S2, A18S3 May 24, 2024
jahorton added a commit that referenced this pull request May 30, 2024
@jahorton jahorton merged commit c5f8ca6 into master May 30, 2024
15 checks passed
@jahorton jahorton deleted the fix/web/error-without-neighbor branch May 30, 2024 06:59
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.45-alpha

3 similar comments
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.45-alpha

@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.45-alpha

@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.45-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants